unit Scenes;

interface

uses Classes;

const
  scMenu  = 0;
  scGame  = 1;
  scFrame = 2;

type
  TScene = class(TObject)
    procedure Render(); virtual; abstract;
    procedure Update(); virtual; abstract;
  end;

type
  TScenes = class(TScene)
  private
    FScene: TScene;
    procedure SetScene(const Value: TScene);
  public
    procedure Render(); override;
    procedure Update(); override;
    property Scene: TScene read FScene write SetScene default nil;
    procedure Clear;
  end;

var
  SceneManager: TScenes;
  CurrentScene: array of TScene;

implementation

uses gm_engine;

{ TScenes }

procedure TScenes.Clear;
begin
  Scene := nil;
end;

procedure TScenes.Render;
begin
  if (Scene <> nil) then Scene.Render;
end;

procedure TScenes.Update;
begin
  if (Scene <> nil) then Scene.Update;
end;

procedure TScenes.SetScene(const Value: TScene);
begin
  FScene := Value;
  ClearStates;
end;

end.
